-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Emit allocator attributes for allocator shim #147150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
+26
−4
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This emits the same attributes we place on allocator declarations (and allocator definitions using `#[global_allocator]`) on the definitions in the allocator shim as well, making sure that the attributes are not lost if the allocator shim participates in LTO.
@bors r+ |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Sep 29, 2025
Emit allocator attributes for allocator shim This emits the same attributes we place on allocator declarations on the definitions in the allocator shim as well. This complements rust-lang#146766, which added the attribute for `#[global_allocator]` definitions. Emitting the attributes on the definitions ensures that they cannot be lost of the allocator shim participates in LTO. See rust-lang#145995 for context, though that one was about `#[global_allocator]`. I'm not sure whether this can occur with the allocator shim as well or not, but better safe than sorry. I'm not sure whether there is any good way to test this, as the allocator shim is not part of `--emit=llvm-ir`. I've verified this locally by inspecting the bitcode produced by `-C save-temps`. r? `@bjorn3`
bors
added a commit
that referenced
this pull request
Sep 29, 2025
Rollup of 6 pull requests Successful merges: - #143613 (Fix backtraces with `-C panic=abort` on linux; emit unwind tables by default) - #146937 (std: implement `hostname`) - #147040 (mbe: macro_check: Fix function comments referencing non-existent parameters) - #147131 (Use MirPatch in simplify_branches.) - #147133 (Remove one loop in `extract_cfg_from_attrs`) - #147150 (Emit allocator attributes for allocator shim) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
that referenced
this pull request
Sep 29, 2025
Rollup of 5 pull requests Successful merges: - #146937 (std: implement `hostname`) - #147040 (mbe: macro_check: Fix function comments referencing non-existent parameters) - #147131 (Use MirPatch in simplify_branches.) - #147133 (Remove one loop in `extract_cfg_from_attrs`) - #147150 (Emit allocator attributes for allocator shim) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Sep 30, 2025
Rollup merge of #147150 - nikic:alloc-shim-attributes, r=bjorn3 Emit allocator attributes for allocator shim This emits the same attributes we place on allocator declarations on the definitions in the allocator shim as well. This complements #146766, which added the attribute for `#[global_allocator]` definitions. Emitting the attributes on the definitions ensures that they cannot be lost of the allocator shim participates in LTO. See #145995 for context, though that one was about `#[global_allocator]`. I'm not sure whether this can occur with the allocator shim as well or not, but better safe than sorry. I'm not sure whether there is any good way to test this, as the allocator shim is not part of `--emit=llvm-ir`. I've verified this locally by inspecting the bitcode produced by `-C save-temps`. r? ``@bjorn3``
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This emits the same attributes we place on allocator declarations on the definitions in the allocator shim as well. This complements #146766, which added the attribute for
#[global_allocator]
definitions. Emitting the attributes on the definitions ensures that they cannot be lost of the allocator shim participates in LTO.See #145995 for context, though that one was about
#[global_allocator]
. I'm not sure whether this can occur with the allocator shim as well or not, but better safe than sorry.I'm not sure whether there is any good way to test this, as the allocator shim is not part of
--emit=llvm-ir
. I've verified this locally by inspecting the bitcode produced by-C save-temps
.r? @bjorn3